<?php

/*
	info: 前台找回密码
*/

define('NOT_LOGIN', TRUE);
require dirname(__FILE__).'/include/common.inc.php';

$webconfig['web_findpasshour'] = 48;

if (!isset($webrequest['code']))
{
	exit();
}
$tempcodearray = explode(',', global_DecryptKey($webrequest['code']));
if (count($tempcodearray)!=3)
{
	exit();
}
$tempuid = intval($tempcodearray[0]);
$tempoldpass = trim($tempcodearray[1]);
$tempposttime = intval($tempcodearray[2]);
if ($tempuid<=0 || $tempoldpass=='' || $tempposttime<=0)
{
	exit();
}
$webglobal['userinfo'] = $db->GetOne("SELECT * FROM user WHERE uid='{$tempuid}'");
if (empty($webglobal['userinfo']) || substr($webglobal['userinfo']['password'],$webglobal['userinfo']['uid']%9,9)!=$tempoldpass || $webserver['timestamp']-$tempposttime>$webconfig['web_findpasshour']*3600)
{
	global_ShowMessage('当前链接已失效。');
}


template_Display('findpass');
